package com.aistar.mapper;

import com.aistar.model.entity.Project;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;


import java.util.List;

public interface ProjectMapper {
    //根据resumeId获取项目信息
    @Select("select * from project where resume_id = #{resumeId} ")
    List<Project> findByResumeId(Integer resumeId);

    //根据id获取项目信息
    @Select("select * from project where id = #{id}")
    Project fingById(Integer id);

    //根据id更新项目经历信息
    @Update("update project set name=#{name},link=#{link},description=#{description},start_time=#{startTime},end_Time=#{endTime} where id = #{id}")
    Integer updateProject(Project project);

    //添加项目经历信息
    @Insert("insert into project(name,link,description,start_time,end_time,resume_id) values(#{name},#{link},#{description},#{startTime},#{endTime},#{resumeId})")
    Integer insertProject(Project project);

//    //删除项目经历
//    @Delete("delete from project where id = #{id} and resume_id = #{resumeId}")
//    Integer deleteProjectByIdAndResumeId(Integer id,Integer resumeId);

    //删除简历的所有实习经历
    @Delete("delete from project where resume_id = #{resumeId}")
    Integer deleteProjectByResumeId(Integer resumeId);

    @Delete("delete from project where id = #{id}")
    Integer deleteProjectById(Integer id);
}
